#include "head.h"
int recordNum(char argvn[][100],int flag)//统计条数的目的是为了排序
{
	//char str[200];//用于使用fgets统计记录数
	int len = 0;
	char c;
	FILE* fsp;
	switch (flag)
	{
	case 1:fsp = fopen(argvn[1], "r+"); break;
	case 2:fsp = fopen(argvn[2], "r+"); 
		if (NULL == fsp)
		{
			perror("fopen");
		}break;

	case 3:fsp = fopen(argvn[3], "r+"); break;
	default:return -1;
	}
	//while (fgets(str, 200, fsp) != NULL)//统计记录条数
	while ((c = fgetc(fsp)) != EOF)//统计记录条数
	{
		if ('\n' == c)
		{
		len++;
		}
	}
	fclose(fsp);
	return len;
}
